if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function(x) {
    var result = -1
    if (this.length == 0) {
      return result
    }
    for (var i = 0; i < this.length; i++) {
      if (this[i] === x) {
        result = i
        break
      }
    }
    return result
  }
}

if (!document.getElementsByClassName) {
  document.getElementsByClassName = function(c_name, ele) {
    var arr = []
    var allTag = (ele || document).getElementsByTagName('*')
    var tagLength = allTag.length
    var cNameList = c_name.split(' ')
    var cNameLength = cNameList.length
    for (var i = 0; i < tagLength; i++) {
      var classList = allTag[i].className.split(' ')
      var listLength = classList.length
      var judge = []
      for (var t = 0; t < cNameLength; t++) {
        if (classList.indexOf(cNameList[t]) !== -1) {
          judge.push(true)
        }
      }
      if (judge.length === cNameLength) {
        arr.push(allTag[i])
      }
    }
    return arr
  }
}

Function.prototype.bind = Function.prototype.bind || function (context) {

    if (typeof this !== "function") {
      throw new Error("Function.prototype.bind - what is trying to be bound is not callable");
    }

    var self = this;
    var args = Array.prototype.slice.call(arguments, 1);

    var fNOP = function () {};

    var fBound = function () {
        var bindArgs = Array.prototype.slice.call(arguments);
        return self.apply(this instanceof fNOP ? this : context, args.concat(bindArgs));
    }

    fNOP.prototype = this.prototype;
    fBound.prototype = new fNOP();
    return fBound;
}

var IE_VERSION = (function() {
  if (window.VBArray) {
    var mode = document.documentMode
    return mode ? mode : window.XMLHttpRequest ? 7 : 6
  }
  return 0
})()
